#!/usr/bin/env python3
import sys
from tcpserver import *
from tcpclient import *
from udpserver import *
from udpclient import *

#parameters: -s|-c -t|--tcp|-u|--udp PORT [HOST]
def main(argv):
    #tcp server
    if (sys.argv[1]=="-s" and (sys.argv[2] in ["-t","--tcp"])):
        tcpserver(sys.argv[3])
    #tcp client
    if (sys.argv[1]=="-c" and (sys.argv[2] in ["-t","--tcp"])):
        tcpclient(sys.argv[4],sys.argv[3])
    #udp server
    if (sys.argv[1]=="-s" and (sys.argv[2] in ["-u","--udp"])):
        udpserver(sys.argv[3])
    #udp client
    if (sys.argv[1]=="-c" and (sys.argv[2] in ["-u","--udp"])):
        udpclient(sys.argv[4],sys.argv[3])
    else:
        print("bye")

if __name__ == "__main__":
   main(sys.argv[1:])
